package com.example.service.impl;

import com.example.entity.Friend;
import com.example.entity.User;
import com.example.mapper.FriendMapper;
import com.example.service.FriendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FriendServiceImpl implements FriendService {

    @Autowired
    FriendMapper friendMapper;


    @Override
    public void insert(Friend record) {
        friendMapper.insert(record);
    }

    @Override
    public Boolean checkIsAdd(Integer friendUid, Integer uid) {
        Friend friend = friendMapper.checkIsAdd(friendUid, uid);
        if (friend != null) {
            return true;
        } else {
            return false;
        }
    }

    @Override
    public List<User> selectMyFriend(Integer uid) {
        return friendMapper.selectMyFriend(uid);
    }
}
